package com.example.membersteward;

import io.jsonwebtoken.SignatureAlgorithm;
import io.jsonwebtoken.security.Keys;
import javax.crypto.SecretKey;

public class KeyGenerator {
    public static SecretKey generateKey(SignatureAlgorithm algorithm) {
        return Keys.secretKeyFor(algorithm);
    }

    public static void main(String[] args) {
        SecretKey key = generateKey(SignatureAlgorithm.HS512);
        // 可将密钥转换为 Base64 编码以便查看和使用
        String keyBase64 = java.util.Base64.getEncoder().encodeToString(key.getEncoded());
        System.out.println("Generated Key (Base64): " + keyBase64);
    }
}